/*
 * This file is part of Catfish.
 * Copyright (C) 2010 Namazu Studios LLC
 * 
 * Catfish is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as 
 * published by the Free Software Foundation, either version 3 of 
 * the License, or (at your option) any later version.
 * 
 * Catfish is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with Catfish.  If not, please visit:
 *  
 * http://www.gnu.org/licenses/
 *  
 */
package com.namazustudios.catfish.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Indicates that the given field is a child entity of enclosing type. The
 * annotated type must contain the @Entity annotation. When marshalling, a
 * property will be added to the entity containing the key of the child object.
 * This represents an owned relationship and the child and parent object are
 * part of the same entity group.
 * 
 * If this annotates a field of Collection type Catfish will marshall each
 * object in the collection as a child of this entity. The same rules apply as
 * with a single property. Each object's type in the array must be annotated
 * with the @Entity annotation.
 * 
 * @author patrick
 * 
 */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Child {

    /**
     * Gets the name of the property on the Entity. If left unspecified, this
     * will use the name of the annotated field.
     * 
     * @return the name of the Property.
     */
    public String name() default "";

}
